# Python 2.6.4
# Project Euler, Problem 9
# Copyright 2010 Talha Zaman

squares = [x**2 for x in range(1,1000)]
for i in squares:
    for j in squares:
        if j<i: continue
        if (i+j in squares):
            a = squares.index(i) + 1
            b = squares.index(j) + 1
            c = squares.index(i+j) + 1
            if (a+b+c==1000):
                print a,b,c,a*b*c
